package models

import (
	"time"
)

type UserSession struct {
	ID           uint      `gorm:"primaryKey" json:"id"`
	UserID       uint      `gorm:"index" json:"user_id"`
	OrgId        int       `gorm:"index" json:"org_id"`
	GroupId      int       `json:"group_id"`
	NickName     string    `json:"nick_name"`
	Token        string    `gorm:"size:255;uniqueIndex" json:"token"`
	RefreshToken string    `gorm:"size:255" json:"-"`
	DeviceInfo   string    `gorm:"size:255" json:"device_info"`
	IPAddress    string    `gorm:"size:50" json:"ip_address"`
	ExpiresAt    time.Time `json:"expires_at"`
	IsActive     bool      `gorm:"default:true" json:"is_active"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

// TableName 设置表名
func (UserSession) TableName() string {
	return "user_session"
}
